package com.example.huadi1.service.Imp;

import com.example.huadi1.dto.StockChange;
import com.example.huadi1.dto.TextbookChange;
import com.example.huadi1.mapper.StockChangeMapper;
import com.example.huadi1.service.StockChangeService;
import com.example.huadi1.utils.AjaxResult;
import com.example.huadi1.utils.PageUtils;
import com.example.huadi1.utils.Request.SinglePageRequest;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class StockChangeServiceImp implements StockChangeService {
    @Autowired
    StockChangeMapper stockChangeMapper;
    @Override
    public AjaxResult query(SinglePageRequest singlePageRequest) {
        PageHelper.startPage(singlePageRequest.getPageNum(), singlePageRequest.getPageSize());
        List<StockChange> textbookChanges=stockChangeMapper.selectAllStockChange();
        PageInfo<StockChange> pageAll = PageInfo.of(textbookChanges);
        PageUtils pageUtils = new PageUtils(pageAll);
        AjaxResult result=AjaxResult.success(pageUtils);
        return result;
    }
}
